DISCUSSION
If another task currently occupies the critical region, the current task is blocked until the critical region is released or until the designated timeout expires. Otherwise the task enters the critical region and
MPEnterCriticalRegion
increments the region's use count.
Once a task enters a critical region it can make further calls to
MPEnterCriticalRegion
without blocking (its use count increments for each call). However, each call to
MPEnterCriticalRegion
must be balanced by a call to
MPExitCriticalRegion
; otherwise the region is not released for use by other tasks.
Note that you can enter a critical region from a cooperative task. Each cooperative task is treated as unique and different from any preemptive task. If you call this function from a cooperative task, you should specify only
kDurationImmediate
for the timeout length; other waits will cause the task to block.